import java.util.Scanner;

class NameException extends RuntimeException{
    public NameException(String message){
        super(message);
    }

}
class PasswordException extends RuntimeException{
    public PasswordException(String message){
        super(message);
    }
}

public class TestDemo {
    private static final String name = "bit";
    private static final String password = "123";

    public static void login(String name, String password)throws NameException,PasswordException {
        if(!TestDemo.name.equals(name)){
            throw new NameException("用户名错误");
        }
        if(!TestDemo.password.equals(password)){
            throw new PasswordException("密码错误");
        }
    }

    public static void main(String[] args){
        try{
            Scanner scan = new Scanner(System.in);
            String str = scan.nextLine();
            String strPassword = scan.nextLine();
            login(str, strPassword);
        }catch(NameException e){
            System.out.println("用户名错误");

        }catch(PasswordException e){
            e.printStackTrace();
            System.out.println("密码错误");
        }finally{
            System.out.println("finally执行了");
        }
    }
}
